﻿/* File Created: ožujka 20, 2012 */

$(document).ready(function () {
	fcall2();
	fcall();

});

//Poziva web servis koji daje popis (staze) svih slika sadrzanih unutar galerije 
//slideshowa
function fcall() {

	$.ajax({
		type: "POST",
		url: "SlideshowBannerImageList.asmx/GetThumbsList",
		data: "{}",
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: f
	});
}


//Poziva web servis koji daje listu html koda koji se upisuje u informativni div za svaku
//sliku trenutno prikazanu na ekranu
function fcall2()
{
	$.ajax({
		type: "POST",
		url: "SlideshowBannerImageList.asmx/GetAditionalHtmlList",
		data: "{}",
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: f2
	});
}

function f2(data,status)
{
	window.variables={
		htmlData:data.d
	}
	$('.slide_info').html(window.variables.htmlData[0]);

}

function f(data,status) {
	var dat = data.d;
	$.each(dat, function (index, item) {
		$('.slides_container').append("<div class='slide'><img src="+item+" alt='image'  /></div>");
});


//Aktivira slides kontrolu sa odgovarajucim postavkama
$('#slides').slides({
	play: 5000,
	pause: 2500,
	hoverPause: true,
	crossfade: true,
	animationComplete: function (current) {

		$('.slide_info').fadeOut(function () { $('.slide_info').html(window.variables.htmlData[current-1]); });
	   
		$('.slide_info').fadeIn(2000);
	}
});

$('.pagination li a').text('');
}

